home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-9.10-netbook-remix-PL.iso / casper / filesystem.squashfs / etc / init.d / umountroot < prev    next >
Text File  |  2009-10-14  |  2KB  |  63 lines

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          umountroot
  4. # Required-Start:
  5. # Required-Stop:
  6. # Should-Stop:       halt reboot kexec
  7. # Default-Start:
  8. # Default-Stop:      0 6
  9. # Short-Description: Mount the root filesystem read-only.
  10. ### END INIT INFO
  11.  
  12. PATH=/sbin:/bin
  13. . /lib/init/vars.sh
  14.  
  15. . /lib/lsb/init-functions
  16.  
  17. do_stop () {
  18.     [ "$VERBOSE" = no ] || log_action_begin_msg "Mounting root filesystem read-only"
  19.     # These directories must exist on the root filesystem as they are
  20.     # targets for system mountpoints.  We've just unmounted all other
  21.     # filesystems, so either they are mounted now (in which case the
  22.     # mount point exists) or we can make the mountpoint.
  23.     for dir in /proc /sys /var/run /var/lock; do
  24.         mkdir -p $dir || true
  25.     done
  26.  
  27.     # Ask init to reexec itself before we go down if it has been
  28.     # upgraded this cycle.  It'll lose all its state, but at least
  29.     # it won't hold open files on the root filesystem
  30.     [ -f /var/run/init.upgraded ] && telinit u || :
  31.  
  32.     MOUNT_FORCE_OPT=
  33.     [ "$(uname -s)" = "GNU/kFreeBSD" ] && MOUNT_FORCE_OPT=-f
  34.     # This:
  35.     #     mount -n -o remount,ro /
  36.     # will act on a bind mount of / if there is one.
  37.     # See #339023 and the comment in checkroot.sh
  38.     mount    $MOUNT_FORCE_OPT -n -o remount,ro -t dummytype dummydev / 2>/dev/null \
  39.     || mount $MOUNT_FORCE_OPT -n -o remount,ro              dummydev / 2>/dev/null \
  40.     || mount $MOUNT_FORCE_OPT -n -o remount,ro                       /
  41.     ES=$?
  42.     [ "$VERBOSE" = no ] || log_action_end_msg $ES
  43. }
  44.  
  45. case "$1" in
  46.   start)
  47.     # No-op
  48.     ;;
  49.   restart|reload|force-reload)
  50.     echo "Error: argument '$1' not supported" >&2
  51.     exit 3
  52.     ;;
  53.   stop)
  54.     do_stop
  55.     ;;
  56.   *)
  57.     echo "Usage: $0 start|stop" >&2
  58.     exit 3
  59.     ;;
  60. esac
  61.  
  62. :
  63.